package domain

import (
	"time"
)

const (
	ClubFieldOwnerAssets = "Assets"
	ClubFieldFavicon     = "Favicon"
	ClubFieldCoverImages = "CoverImages"
	ClubFieldLeaders     = "Leaders"
	ClubFieldPage        = "Page"
)
const (
	ClubColumnOuterVisible = "outer_visible"
	ClubColumnInnerVisible = "inner_visible"
)

type Club struct {
	ID           int64                   `json:"id"`
	Name         string                  `json:"name" gorm:"type:varchar(255);not null;unique"`
	FaviconID    *int64                  `json:"-"`
	PageID       *int64                  `json:"-"`
	Introduction *string                 `json:"introduction"`
	Location     *string                 `json:"location"`
	Address      *string                 `json:"address"`
	PrimaryColor string                  `json:"primary_color" gorm:"not null;default:'#FFFFFF'"`
	CreatedAt    time.Time               `json:"created_at" `
	UpdatedAt    time.Time               `json:"updated_at" `
	OuterVisible bool                    `json:"outer_visible" gorm:"not null;default:true"`
	InnerVisible bool                    `json:"inner_visible" gorm:"not null;default:true"`
	OwnerAssets  []*Assets               `json:"owner_assets" gorm:"many2many:club_assets"`
	Favicon      *Assets                 `json:"favicon" gorm:"foreignKey:FaviconID"`
	CoverImages  []*Assets               `json:"cover_image" gorm:"many2many:club_cover_images"`
	Leaders      []*UserActor            `json:"leaders" gorm:"foreignKey:ClubID"`
	Page         *ClubPage               `json:"page" gorm:"foreignKey:PageID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	UserStruct   []*ClubUserStruct       `json:"user_struct" gorm:"foreignKey:ClubID"`
	Department   []*ClubDepartmentStruct `json:"department" gorm:"foreignKey:ClubID;"`
}
type ClubDTO struct {
	ID           int64                      `json:"id"`
	Name         string                     `json:"name" gorm:"type:varchar(255);not null;unique"`
	FaviconID    *int64                     `json:"-"`
	PageID       *int64                     `json:"-"`
	Introduction *string                    `json:"introduction"`
	Location     *string                    `json:"location"`
	Address      *string                    `json:"address"`
	PrimaryColor string                     `json:"primary_color"`
	CreatedAt    time.Time                  `json:"created_at" `
	UpdatedAt    time.Time                  `json:"updated_at" `
	OuterVisible bool                       `json:"outer_visible" gorm:"default:true"`
	InnerVisible bool                       `json:"inner_visible" gorm:"default:true"`
	OwnerAssets  []*AssetsDTO               `json:"owner_assets" gorm:"many2many:club_assets"`
	Favicon      *AssetsDTO                 `json:"favicon" gorm:"foreignKey:FaviconID"`
	CoverImages  []*AssetsDTO               `json:"cover_image" gorm:"many2many:club_cover_images"`
	Leaders      []UserActorDTO             `json:"leaders" gorm:"foreignKey:ClubID"`
	Page         *ClubPageDTO               `json:"page" gorm:"foreignKey:PageID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	UserStruct   []*ClubUserStructDTO       `json:"user_struct" gorm:"foreignKey:ClubID"`
	Department   []*ClubDepartmentStructDTO `json:"department" gorm:"foreignKey:ClubID;"`
}
